package com.sclibackup.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sclibackup.common.DataSourceChange;
import com.sclibackup.dao.MypktDtlMapper;
import com.sclibackup.dao.MypktHdrMapper;
import com.sclibackup.model.MypktDtl;
import com.sclibackup.model.MypktDtlExample;
import com.sclibackup.model.MypktHdr;
import com.sclibackup.model.MypktHdrExample;
import com.sclibackup.model.MypktHdrExample.Criteria;
import com.sclibackup.service.IOrderService;

@Service
public class OrderServiceImpl implements IOrderService{
	

	@Autowired
	private MypktHdrMapper hdrMapper;
	@Autowired
	private MypktDtlMapper dtlMapper;

	@Override
	public List<MypktHdr> GetMypktHdrDataByDate(Date preDate, Date curDate) {
		MypktHdrExample me = new MypktHdrExample();
		Criteria ci = me.createCriteria();
		ci.andModifyDateGreaterThanOrEqualTo(preDate);
		ci.andModifyDateLessThanOrEqualTo(curDate);
		return hdrMapper.selectByExample(me);
	}

	@Override
	@DataSourceChange(slave = true)
	public int SaveMypktHdr(MypktHdr hdr) {
		return hdrMapper.insertSelective(hdr);
	}

	@Override
	@DataSourceChange(slave = true)
	public int SaveMypktDtl(MypktDtl dtl) {
		return dtlMapper.insertSelective(dtl);
	}

	@Override
	public List<MypktDtl> GetMypktDtlDataByDate(Date preDate, Date curDate) {
		MypktDtlExample me = new MypktDtlExample();
		com.sclibackup.model.MypktDtlExample.Criteria ci = me.createCriteria();
		ci.andModifyDateGreaterThanOrEqualTo(preDate);
		ci.andModifyDateLessThanOrEqualTo(curDate);
		return dtlMapper.selectByExample(me);
	}
	
	
	
	
	
	
	
	
}
